package com.yuntsg.nnsfcp.util.httpclient;

import lombok.Data;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;

import java.util.Map;

/**
 * @author claud 2018年8月15日17:47:52 httpclient的所需参数类
 */
@Data
public class HttpClientConfig {

    public static final String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0";
    // 连接的限制次数--即各个网站chapter页面在抓取多少次时可能出现的问题:根据之前经验1知网大约1500次 2.万方大约80次 3.维普不封账号.
    public static int CONNECT_LIMIT = 0;
    public static int connectionNums = 0; // 记录httpclient的连接次数
    public static int establishedStatus = 1; // 记录网络连通状态的标志，0代表网络不通 程序需要等待 1代表开通
    //	public static int volumeFlag=0;       //记录通过volume连接的次数，超过两千次就重新连接（可以不使用？）
    public static int timeoutNums = 0; // 记录出现connect time out 的次数
    public static int currentYear; // 抓取的当前年份--知网抓取用到
    /**
     * 默认的超时时间--wos的一般时间都很长，需要设置为25000
     */
    public static int TIME_OUT = 15000;

    // 请求配置
    private RequestConfig requestConfig;

    // 代理请求配置
    private CredentialsProvider credsProvider;

    private Map<String, String> headerMap;

    private String refer;

    private String host;

    /**
     * 需要跳转的地址
     */
    private String url;
    /**
     * pdf的存放路径
     */
    private String pdfPath;

    public static int getCONNECT_LIMIT() {
        return CONNECT_LIMIT;
    }

    public static void setCONNECT_LIMIT(int cONNECT_LIMIT) {
        CONNECT_LIMIT = cONNECT_LIMIT;
    }

    public static int getConnectionNums() {
        return connectionNums;
    }

    public static void setConnectionNums(int connectionNums) {
        HttpClientConfig.connectionNums = connectionNums;
    }

    public static int getEstablishedStatus() {
        return establishedStatus;
    }

    public static void setEstablishedStatus(int establishedStatus) {
        HttpClientConfig.establishedStatus = establishedStatus;
    }

    public static int getTimeoutNums() {
        return timeoutNums;
    }

    public static void setTimeoutNums(int timeoutNums) {
        HttpClientConfig.timeoutNums = timeoutNums;
    }

    public static int getCurrentYear() {
        return currentYear;
    }

    public static void setCurrentYear(int currentYear) {
        HttpClientConfig.currentYear = currentYear;
    }

    public static int getTIME_OUT() {
        return TIME_OUT;
    }

    public static void setTIME_OUT(int tIME_OUT) {
        TIME_OUT = tIME_OUT;
    }

    public static String getUserAgent() {
        return USER_AGENT;
    }

    public RequestConfig getRequestConfig() {
        return requestConfig;
    }

    public void setRequestConfig(RequestConfig requestConfig) {
        this.requestConfig = requestConfig;
    }

    public CredentialsProvider getCredsProvider() {
        return credsProvider;
    }

    public void setCredsProvider(CredentialsProvider credsProvider) {
        this.credsProvider = credsProvider;
    }

    public Map<String, String> getHeaderMap() {
        return headerMap;
    }

    public void setHeaderMap(Map<String, String> headerMap) {
        this.headerMap = headerMap;
    }

    public String getRefer() {
        return refer;
    }

    public void setRefer(String refer) {
        this.refer = refer;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPdfPath() {
        return pdfPath;
    }

    public void setPdfPath(String pdfPath) {
        this.pdfPath = pdfPath;
    }

}
